package yichang;

import java.util.Scanner;

/**
 * @author 跑出异常
 */
public class CE_paochu {
    public static void main(String[] args) {

        System.out.println("请输入被除数");
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        System.out.println("请输入除数");
        Scanner sa = new Scanner(System.in);
//        调用方法完成除法
//        另一种：用户必须加try catch
        int b = sa.nextInt();
        int result = 0;
        try {
            result = Chufa.chufa(a, b);
            System.out.println("结果是" + result);
        } catch (Exception e) {
            System.out.println("异常是" + e.getMessage());
        } finally {
            System.out.println("可以写可以不写，都会执行");
        }
        try {
            result = Chufa.chufa(a, b);
            System.out.println();
        } catch (Exception e) {
            System.out.println("异常是" + e.getMessage());
        } finally {
        }

    }

}
